import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.FileNotFoundException;

public class Dbconnect
{
	public Dbconnect(String filename)
	{
		try
		{
			Properties properties=new Properties();
			properties.load(new FileInputStream(filename));
			String driver=properties.getProperty("driver");
			String url=properties.getProperty("url");
			String user=properties.getProperty("user");
			String password=properties.getProperty("password");
			Class.forName(driver);
			Connection con=DriverManager.getConnection(url, user, password);
			Statement stat=con.createStatement();
			ResultSet rs=stat.executeQuery("SELECT * FROM a02_user");
			while (rs.next())
			{
				System.out.println("The user name is "+rs.getString("a02_fullname"));
			}
			rs.close();
			stat.close();
			con.close();
		}
		catch (IOException e)
		{
			System.out.println("IO Exception");
			e.printStackTrace();
		}
		catch (ClassNotFoundException e)
		{
			System.out.println("Classnotfound Exception");
			e.printStackTrace();
		}
		catch (SQLException e)
		{
			System.out.println("SQL Exception");
			e.printStackTrace();
		}
		
	}

	public static void main(String args[])
	{
		Dbconnect dbconnect=new Dbconnect(args[0]);
	}
}